package day004;

public class Methodtest01 {
    public static void main(String[] args) {
        int result = getSum(5);
        System.out.println("1-5的和是：" + result);

        int result2 = getSum(10);
        System.out.println("1-10的和是：" + result2);
    }

    public static int getSum(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }

        return sum;
    }
}
